﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BOM.entity;
using BOM.dao;
using BOM.BaseData;

namespace BOM.SysAdmin
{
    public partial class ParamForm : Form
    {
        public ParamForm()
        {
            InitializeComponent();
        }
        //窗体的加载事件
        private void ParamForm_Load(object sender, EventArgs e)
        {
            txtNumber.ReadOnly = true;
            txtParamName.ReadOnly = true;
            btnEdit.Enabled = false;
            DataTable table = ParamNew.SelectParamfid(CustomerList.XuanZID);
            if (table != null)
            {
                txtNumber.Text = table.Rows[0]["fnumber"].ToString();
                txtParamName.Text = table.Rows[0]["fname"].ToString();
                txtParamValue.Text = table.Rows[0]["fvalue"].ToString();
            }
        }
        //退出按钮
        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
        //保存按钮
        private void btnSave_Click(object sender, EventArgs e)
        {
            Paramsurface param = new Paramsurface();
            param.Fnumber = txtNumber.Text;
            param.Fname = txtParamName.Text;
            param.Fvalue = float.Parse(txtParamValue.Text);
            bool bl = ParamNew.UpdateParamfna(CustomerList.XuanZID);
            if (bl == true)
            {
                ParamList paramlist = (ParamList)this.Owner;
                paramlist.Loadingdataview();

                MessageBox.Show("修改成功", "提示");
            }
            else
            {
                MessageBox.Show("修改失败", "提示");
            }
        }
    }
}
